package com.study.annotation.demo;

import java.util.ArrayList;

import org.junit.Test;

/**
* @Name: AnnotationDemo01
* @Description: JDK内置注解测试类
* @Author: 李超	lc_jack@foxmail.com
* @CreateDate: 2017-1-19 上午9:14:42 
* @Version: V1.0
 */
public class AnnotationDemo01 /*extends Object*/ {
	
	/**
	* @Name: toString
	* @Description: 重写父类Object的toString()方法：由@Override注解标记。
	* @Override注解源码：
	* 	@Target(ElementType.METHOD)
		@Retention(RetentionPolicy.SOURCE)
		public @interface Override {
		}
	* @Author: 李超	lc_jack@foxmail.com
	* @Version: V1.0
	* @CreateDate: 2017-1-19 上午9:16:12
	* @Parameters: 无
	* @Return: void 无
	 */
	@Override
	public String toString() {
		return null;
	}
	
	/**
	* @Name: print
	* @Description: @Deprecated注解：标记已经过时的类、方法和属性，不建议使用过时标记的类、方法和属性。
	* @Deprecated注解源码：
	* 	A program element annotated &#64;Deprecated is one that programmers
	* 	are discouraged from using, typically because it is dangerous,
	* 	or because a better alternative exists.  Compilers warn when a
	* 	deprecated program element is used or overridden in non-deprecated code.
	* 	@Documented
		@Retention(RetentionPolicy.RUNTIME)
		@Target(value={CONSTRUCTOR, FIELD, LOCAL_VARIABLE, METHOD, PACKAGE, PARAMETER, TYPE})
		public @interface Deprecated {
		}
	* @Author: 李超	lc_jack@foxmail.com
	* @Version: V1.0
	* @CreateDate: 2017-1-19 上午9:23:26
	* @Parameters: 
	* @Return: void
	 */
	@Deprecated
	public void print() {
		System.out.println("该方法已过时，不建议使用！");
	}
	
	@Test
	public void test() {
		print() ;
	}
	
	/**
	* @Name: supressWarningsTest
	* @Description: @SuppressWarnings注解：压制编译警告信息
	* @SuppressWarnings注解源码：
	* 	@Target({TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE})
		@Retention(RetentionPolicy.SOURCE)
		public @interface SuppressWarnings {
		    String[] value(); //注解参数：String[]为参数类型，value为参数名称，参数值有deprecation、unchecked、fallthrough、path、serial、finally、all等
		}
	* @Author: 李超	lc_jack@foxmail.com
	* @Version: V1.0
	* @CreateDate: 2017-1-19 上午9:37:21
	* @Parameters: 
	* @Return: void
	 */
	@SuppressWarnings(value={"unused", "rawtypes"})
	public void supressWarningsTest() {
		ArrayList list01 = new ArrayList() ;
 	}
	
	
}


















